package cz.cvut.fit.mi_paa.knapsack;

import cz.cvut.fit.mi_paa.abs.Instance;

/**
 * Created with IntelliJ IDEA.
 * User: milos
 * Date: 28.9.12
 * Time: 0:18
 * To change this template use File | Settings | File Templates.
 */
public class KnapsackInstance extends Instance {
    private int id;
    private int capacity;
    private Item[] items;

    public KnapsackInstance(int id, int capacity, Item[] items) {
        this.id = id;
        this.capacity = capacity;
        this.items = items;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getCapacity() {
        return capacity;
    }

    public void setCapacity(int capacity) {
        this.capacity = capacity;
    }

    public Item[] getItems() {
        return items;
    }

    public void setItems(Item[] items) {
        this.items = items;
    }

    public int getItemNumber() {
        return  items.length;
    }

    public int getHighestPrice() {
        int highestPrice=0;
        for(Item item : items) {
            if(item.getPrice()>highestPrice) highestPrice = item.getPrice();
        }
        return highestPrice;
    }



    @Override
    public String toString() {
        return "id: "+ id + ", capacity: " + capacity;
    }
}
